{% extends "djips/common/base.html" %}
{% load djips_extras %}
{% load i18n %}

{% block title %}
{% blocktrans %}Update image {{image.title}}{% endblocktrans %}
{% endblock %}

{% block content %}
{% if success %}
<p class="info_msg">{% trans "Image has been saved." %}</p>
{% endif %}

<p class="center">
  <a href="{{admin_base_url}}/djips_common/images/{{parent.id}}/">
    {% trans "Back to parent folder" %}</a>
</p>

<form name="manage_image_form"
      class="manage_image_form"
      method="POST"
      action="{{admin_base_url}}/djips_common/image/{{img.id}}/">

  <p class="center wrapper">
    <img src="{{img.file.url}}" alt="Full size image" />
  </p>

  <label for="mark">Mark</label>
  <select name="mark" id="mark">
    {{img.mark|djips_mark_options}}
  </select>
  <br />
  
  <label for="color">{% trans "Category" %}</label>
  <select name="color"
          id="color">
    {{img.color|djips_color_options}}
  </select>
  <br />

  <label for="tags">{% trans "Tags" %}</label><br />
  <textarea name="tags" id="tags">{{img.tags}}</textarea>
  <br />

  <div class=" enableFormTabbing">
  {% for lang in langs %}
  <fieldset id="fieldset-lang{{lang.id}}">
    <legend id="fieldsetlegend-lang{{lang.id}}"> {{lang.name}}</legend>
    <label for="title_{{lang.id}}">{% trans "Title" %}</label>
    <input type="text"
           name="title_{{lang.id}}"
           id="title_{{lang.id}}"
           value="{{img.titles|djips_dynamic_key:lang.id}}" />
    <br />

    <label for="description_{{lang.id}}">
      {% trans "Description" %}
    </label><br />
    <textarea name="description_{{lang.id}}"
              id="description_{{lang.id}}">{{img.descriptions|djips_dynamic_key:lang.id }}</textarea>
    <br />
  </fieldset>
  
  {% endfor %}
  </div>
  <div class="center">
    <input type="submit"
           class="valid"
           name="save"
           value="{% trans "Save image" %}"/>
    <input type="submit"
           class="cancel"
           name="cancel"
           value="{% trans "Cancel" %}"/>
  </div>
</form>
{% endblock %}
